//
//  FliterViewController.swift
//  Wallpaper
//
//  Created by    on 2023/12/20.
//

import UIKit
import SnapKit
class FilterViewController: BaseViewController {
    lazy var typeFiler = {
        let view = FilterItemStackView(headTitle: "Type", titles: ["Grid","Upscale","Describe"], isVertical: true)
        return view
    }()
    
    lazy var modelFiler = {
        let view = FilterItemStackView(headTitle: "Type", titles: ["Main","Anime"], isVertical: false)
        return view
    }()
    
    lazy var aspectFiler = {
        let view = FilterItemStackView(headTitle: "Type", titles: ["Square","Wide","Tall"], isVertical: true)
        return view
    }()
    
    lazy var versionFiler = {
        let view = FilterItemStackView(headTitle: "Type", titles: ["1","2","3"], isVertical: false)
        return view
    }()

    lazy var sortFiler = {
        let view = FilterItemStackView(headTitle: "Type", titles: ["Likes","Popularity"], isVertical: false)
        return view
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.title = "Filter"
    }
    
    override func addSubViews() {
        self.view.addSubview(typeFiler)
        typeFiler.snp.makeConstraints { make in
            make.left.equalTo(20)
            make.top.equalTo(100)
            make.right.equalTo(-20)
        }
        
        self.view.addSubview(modelFiler)
        modelFiler.snp.makeConstraints { make in
            make.left.equalTo(20)
            make.top.equalTo(typeFiler.snp.bottom).offset(10)
            make.right.equalTo(-20)
        }
        
        self.view.addSubview(aspectFiler)
        aspectFiler.snp.makeConstraints { make in
            make.left.equalTo(20)
            make.top.equalTo(modelFiler.snp.bottom).offset(10)
            make.right.equalTo(-20)
        }
        
        self.view.addSubview(versionFiler)
        versionFiler.snp.makeConstraints { make in
            make.left.equalTo(20)
            make.top.equalTo(aspectFiler.snp.bottom).offset(10)
            make.right.equalTo(-20)
        }
        
        self.view.addSubview(sortFiler)
        sortFiler.snp.makeConstraints { make in
            make.left.equalTo(20)
            make.top.equalTo(versionFiler.snp.bottom).offset(10)
            make.right.equalTo(-20)
        }
        
        let btn : UIButton = UIButton(type: .custom)
        btn.setTitle("Apply Filters", for: .normal)
        btn.titleLabel?.font = .systemFont(ofSize: 16)
        btn.setTitleColor(UIColor(colorString: "f6f6f6"), for: .normal)
        btn.backgroundColor = UIColor(colorString: "65635F")
        self.view.addSubview(btn)
        btn.snp.makeConstraints { make in
            make.left.equalTo(60)
            make.right.equalTo(-60)
            make.height.equalTo(46)
            make.bottom.equalTo(-20)
        }
        btn.layer.cornerRadius = 23
    }
}
